
package com.htd.htdapmcommon.enums;

public enum ZabbixLevelEnum {

	LEVEL_ONE("0", "未知"),
	LEVEL_TWO("1", "一般信息"),
	LEVEL_THREE("2", "警告"),
	LEVEL_FOUR("3", "一般问题"),
	LEVEL_FIVE("4","严重问题"), 
	LEVEL_SIX("5", "灾难");

	private String code;

	private String msg;

	private ZabbixLevelEnum(String code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	/**
	 * 根据code获取去value
	 * 
	 * @param code
	 * @return
	 */
	public static String getValueByCode(String code) {
		for (ZabbixLevelEnum alarmsLevelEnum : ZabbixLevelEnum.values()) {
			if (code.equals(alarmsLevelEnum.getCode())) {
				return alarmsLevelEnum.getMsg();
			}
		}
		return null;
	}
}
